<script setup>
import { ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useStore } from 'vuex';

const router = useRouter();
const store = useStore();

// 热映电影列表
store.dispatch('hot/updateHotMovieList');
const hotMovieList = computed(() => store.state.hot.hotMovieList);

const IsHot = ref(true);
</script>

<template>
  <div class="movie-header">
    <span class="movie-city">广州</span>
    <span
      :class="{
        'hot-btn': true,
        'hot-btn-on': IsHot,
      }"
      @click="IsHot = true"
    >
      正在热映
    </span>
    <span
      :class="{
        'hot-btn': true,
        'hot-btn-on': !IsHot,
      }"
      @click="IsHot = fasle"
    >
      即将上映
    </span>
    <div class="search"><i-ep-Search class="sear" /></div>
  </div>
  <!-- 电影列表 -->
  <div
    v-if="IsHot"
    class="movie-content"
  >
    <div
      class="movie-item"
      v-for="item in hotMovieList"
      :key="item.movie_id"
    >
      <h3>{{ item.name }}</h3>
      <div class="movie-info">
        <div class="info">
          <span>暂无评分</span>
          <span>类型: {{ item.type }}</span>
          <span>主演: {{ item.actor }}</span>
        </div>
        <div class="movie-sell">购票</div>
      </div>
    </div>
  </div>
  <!-- 影院列表 -->
  <div
    v-else
    class="cinema-content"
  >

  </div>
</template>

<style lang="scss" scope>
body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background-color: #fff;
}
.movie-header {
  box-sizing: border-box;
  width: 100%;
  height: 50px;
  background-color: #dd2727;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 16px;
  .movie-city {
    color: #fff;
    font-size: 16px;
    margin-left: 8px;
  }
  .hot-btn {
    display: inline-block;
    color: #ccc;
    font-weight: 300;
    width: 64px;
    font-size: 16px;
    padding: 8px 0;
  }
  .hot-btn-on {
    font-weight: 400;
    color: #fff;
    border-bottom: 3px solid #fff;
  }
  .search {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    .sear {
      font-size: 20px;
      color: #fff;
    }
  }
}
.movie-content {
  box-sizing: border-box;
  width: 100%;
  height: calc(100% - 50px);
  background-color: #fff;
  .movie-item {
    width: 100%;
    height: 100px;
    box-sizing: border-box;
    border-bottom: 1px solid #f5f5f5;
    h3 {
      margin: 0;
      font-size: 16px;
      color: #333;
      margin-left: 80px;
    }
    .movie-info {
      height: 70px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      .info {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: flex-start;
        margin-left: 80px;
        span {
          font-size: 14px;
          color: #9d9d9d;
        }
      }
      .movie-sell {
        width: 60px;
        height: 30px;
        background-color: #dd2727;
        color: #fff;
        padding: 0 4px;
        font-size: 12px;
        border-radius: 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: 14px;
      }
    }
  }
}
.cinema-content {
  box-sizing: border-box;
  width: 100%;
  height: calc(100% - 50px);
  background-color: #fff;
}
</style>
